﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace System.Windows
{
    public static class RectExtensionMethods
    {

        public static Rect Expand(this Rect rect, double by)
        {
            return new Rect(rect.X - by, rect.Y - by, rect.Width + by * 2, rect.Height + by * 2);
        }

        public static bool EmptyRect(this Rect rect)
        {
            return rect.IsEmpty || ((int)rect.Width) == 0 || ((int)rect.Height) == 0;
        }

        public static Rect Replace(this Rect rect, double x, double y)
        {
            return new Rect(x, y, rect.Width, rect.Height);
        }

        public static Rect Shift(this Rect rect, double x, double y)
        {
            return new Rect(rect.X + x, rect.Y + y, rect.Width, rect.Height);
        }

    }
}
